package com.ljc.service;

import com.ljc.dao.DeviceContractDao;
import com.ljc.dao.DevicePurchaseDemandDao;
import com.ljc.dto.DeviceDistribute;
import com.ljc.dto.DeviceSta;
import com.ljc.dto.DeviceStatAge;
import com.ljc.dto.Devices;
import com.ljc.entity.DeviceContract;
import com.ljc.vo.Count;
import com.ljc.vo.DeviceSearch;
import com.ljc.vo.StaOrg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeviceServiceImpl implements  DeviceService{
    @Autowired
    private DevicePurchaseDemandDao devicePurchaseDemandDao;


    @Override
    public List<Devices> searchByAdmit(DeviceSearch search) {
        return devicePurchaseDemandDao.searchByAdmit(search);
    }

    @Override
    public List<DeviceDistribute> statTotalByAdmit(DeviceSearch deviceSearch) {
        return devicePurchaseDemandDao.statTotalByAdmit(deviceSearch);
    }

    @Override
    public List<String> getAllNameByAdmit(int admitId) {
        return devicePurchaseDemandDao.searchAllName(admitId);
    }

    @Override
    public Count count(int admitId) {
        int i = devicePurchaseDemandDao.countName(admitId);
        int i1 = devicePurchaseDemandDao.countApply(admitId);
        int i2 = devicePurchaseDemandDao.countQuantity(admitId);
        int i3 = devicePurchaseDemandDao.countPrice(admitId);
        Count count = new Count();
        count.setApplyCount(i1);
        count.setQuantityCount(i2);
        count.setNameCount(i);
        count.setPriceCount(i3);
        return count;
    }

    @Override
    public List<String> getAllOrganization(int admitId) {
        return devicePurchaseDemandDao.searchAllOrganization(admitId);
    }

    @Override
    public List<DeviceStatAge> statAgeByAdmit(DeviceSearch deviceSearch) {
        return devicePurchaseDemandDao.statAgeByAdmit(deviceSearch);
    }

    @Override
    public List<Devices> searchByUser(DeviceSearch search) {
        return devicePurchaseDemandDao.searchByUser(search);
    }

    @Override
    public List<DeviceSta> deviceSta(DeviceSearch search) {
        return devicePurchaseDemandDao.deviceSta(search);
    }

    @Override
    public int countQuantityByUser(int userId) {
        return devicePurchaseDemandDao.countQuantityByUser(userId);
    }

    @Override
    public int countPriceByUser(int userId) {
        return devicePurchaseDemandDao.countPriceByUser(userId);
    }

    @Override
    public List<String> searchNameByUser(int userId) {
        return devicePurchaseDemandDao.searchNameByUser(userId);
    }

    @Override
    public List<DeviceStatAge> deviceAgeStaByUser(DeviceSearch deviceSearch) {
        return devicePurchaseDemandDao.deviceAgeStaByUser(deviceSearch);
    }

    @Override
    public List<DeviceSta> staOrg(StaOrg staOrg) {
        return devicePurchaseDemandDao.staByOrg(staOrg);
    }
}
